$("#search").click(function (){ //搜索
    var sreach=$("#sreach").val();
    $.ajax({
        url: Feng.ctxPath + "/receptionPatientsCentral/getAppointmentSelectPatients",
        type: "POST",
        data: {
            reach: sreach
        },
        success: function (data) {
            var text='';
            for (var i = 0; i < data.length; i++) {
                text += '<div class="patient-box-item" onclick="onclickPatients('+"'"+ data[i].reservationsId +"','"+ data[i].scordd +"'"+')" >' +
                    ' <div class="patient-box-item-top">\n' +
                    '     <div class="patient-item-portrait">\n' ;
                if(data[i].sex=='女'){
                    text+= '<img src="https://pynnn.oss-cn-hangzhou.aliyuncs.com/portrait02.png" alt="加载中...">\n' ;
                }else{
                    text+= '<img src="https://pynnn.oss-cn-hangzhou.aliyuncs.com/portrait01.png" alt="加载中...">\n' ;
                }
                text+='</div>\n' +
                    '     <div class="patient-item-information">\n' +
                    '         <div><span style="color: #333333;">'+data[i].customerName+' - '+data[i].customerAge+'岁</span><span>'+data[i].medicalRecordNumber+'</span></div>\n' +
                    '         <div>'+data[i].customerPhone+'</div>\n' +
                    '     </div>\n' +
                    ' </div>\n' +
                    ' <div class="patient-box-item-bottom">\n' +
                    '     <span>来源：</span><span>'+data[i].oneChannel+' - '+data[i].twoChannel+' - '+data[i].thrChannel+'</span>\n' +
                    ' </div>\n' +
                    '</div>' ;
            }
            $(".receptionPatientSea").html(text);
        },
        error: function (data) {

        }
    });
});

function onclickPatients(reservationsId,scordd) { //选中患者回显
    if (scordd == "dd") { // 点击患者跳转页面 - 详情
        window.location.href = Feng.ctxPath + "/receptionPatientsCentral/getCustomerByReservationsIdApp/"+reservationsId;
    } else if (scordd == "sc") {
        window.location.href = Feng.ctxPath + "/receptionPatientsCentral/getReservationsByReservationsIdApp/"+reservationsId;
    }
}

function patient_backHome () { //点击返回跳转页面 - 首页
    window.location.href = Feng.ctxPath + "/receptionPatientsCentral/appointment_index";
}